<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <title>贝达教育</title>
    <link href="../../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/mui.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="../../../src/iconfont/iconfont.css">
  
    <style>
        * {
            outline: none;
            webkit-focus-ring-color: rgba(0, 0, 0, 0);
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
        }
        
        #shop {
            background: #fff;
        }
        
        .IndOneP {
            position: relative;
        }
        
        .chengqu {
            font-size: 12px;
            float: left;
            margin-right: 10px;
        }
        
        .bg.mui-media-object {
            width: 1.8rem;
            height: 1.5rem;
        }
        
        .IndOneE span {
            display: inline-block;
            height: 18px;
            line-height: 18px;
        }
        
        .guanzhu {
            border: solid 1px #25aae3;
            font-size: 12px;
            width: 50px;
            text-align: center;
            color: #25aae3;
            border-radius: 10px;
        }
        
        .swiper-slide img {
            height: auto!important;
        }
        
        .IndOneM {
            margin-top: 5px;
        }
        
        .mui-show-loading {
            position: fixed;
            padding: 5px;
            width: 120px;
            min-height: 120px;
            top: 45%;
            left: 50%;
            margin-left: -60px;
            background: rgba(0, 0, 0, 0.6);
            text-align: center;
            border-radius: 5px;
            color: #FFFFFF;
            visibility: hidden;
            margin: 0;
            z-index: 2000;
            -webkit-transition-duration: .2s;
            transition-duration: .2s;
            opacity: 0;
            -webkit-transform: scale(0.9) translate(-50%, -50%);
            transform: scale(0.9) translate(-50%, -50%);
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
        }
        
        .mui-show-loading.loading-visible {
            opacity: 1;
            visibility: visible;
            -webkit-transform: scale(1) translate(-50%, -50%);
            transform: scale(1) translate(-50%, -50%);
        }
        
        .mui-show-loading .mui-spinner {
            margin-top: 24px;
            width: 36px;
            height: 36px;
        }
        
        .mui-show-loading .text {
            line-height: 1.6;
            font-family: -apple-system-font, "Helvetica Neue", sans-serif;
            font-size: 14px;
            margin: 10px 0 0;
            color: #fff;
        }
        
        .mui-show-loading-mask {
            position: fixed;
            z-index: 1000;
            top: 0;
            right: 0;
            left: 0;
            bottom: 0;
        }
        
        .mui-show-loading-mask-hidden {
            display: none !important;
        }
        
        .shoplist {
            width: 90%;
            margin: 0 auto;
        }
        
        .shoplist ul li {
            float: left;
            width: 48%;
            padding-bottom: 10px;
            /* background: #f1f1f1; */
            /* margin-bottom: 0.1rem; */
        }
        
        .shoplist ul li:nth-child(even) {
            float: right;
        }
        
        .shoplist ul li img {
            width: 100%;
            /* height: 2.5rem; */
        }
        
        .shoplist .title {
            margin-bottom: 0.2rem;
            margin-top: -0.2rem;
            font-size: 14px;
        }
        
        .shopinfo {
            padding: 0.2rem;
            color: #333;
            font-size: 12px;
        }
        
        .shopinfo .shop_title {
            text-overflow: -o-ellipsis-lastline;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            line-height: 15px;
        }
        
        .shopinfo .shop_jifen {
            color: #df0024;
            padding: 0.1rem 0;
        }
        
        .shopinfo .shop_over {
            color: #fff;
            background: #95cdfe;
            border-radius: 10px;
            text-align: center;
            float: left;
            font-size: 10px;
            padding: 0 0.1rem;
            height: 0.3rem;
            line-height: 0.35rem;
            margin-bottom: 0.2rem;
        }
        
        #shop .search {
            background: #FFF;
            height: 32px;
            width: 90%;
            border-radius: 18px;
            z-index: 999;
            margin: 0px auto;
            position: absolute;
            left: 50%;
            margin-left: -45%;
            border: none!important;
            margin-top: 10px;
        }
        
        #shop .searchI {
            width: 100%;
            line-height: 32px;
            border: none;
            color: #282828;
            text-align: center;
            background: url(../images/icon/search.png) no-repeat 9% center;
            background-size: 20px;
            font-size: 14px;
        }
        
        #shop .smallBanner {
            width: 90%;
            margin: 0 auto;
            /* height: 1.6rem; */
        }
        
        #shop .smallBanner img {
            /* height: 50px; */
            border-radius: 100px;
        }
    </style>
</head>

<body>
    <div id="shop">
        <!--banner-开始-->
        <div id="recommend-list">
            <div class="swiper-container">
                <div class="swiper-wrapper"></div>
                <div class="pagination"></div>
            </div>
            <!--banner-结束-->
            <!--腰线-开始-->
            <div class="IndMenu">
                <a v-for="(type,index) in types" class="IndMenuA fl" @tap="openlist(type)">
                    <img :src="type.icon" style="width: 0.5rem; height: 0.5rem;" />
                    <p>{{type.name}}</p>
                </a>
                <div class="clear"></div>
            </div>
            <div id="slider" class="mui-slider smallBanner">
                <div class="mui-slider-group mui-slider-loop" id="stul">
                    <!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
                    <div class="mui-slider-item mui-slider-item-duplicate" v-if="banners!==undefined && banners.length>0">
                        <a href="#">
                            <img :src="banners[banners.length-1]" />
                        </a>
                    </div>
                    <!-- v-for循环 -->
                    <div class="mui-slider-item" v-for="(pic,index) in banners">
                        <a href="#">
                            <img :src="pic" />
                        </a>
                    </div>
                    <!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
                    <div class="mui-slider-item mui-slider-item-duplicate">
                        <a href="#">
                            <img :src="banners[0]" />
                        </a>
                    </div>
                </div>
                <div class="mui-slider-indicator" id="sliin">
                    <div class="mui-indicator mui-active"></div>
                    <div class="mui-indicator"></div>

                </div>
            </div>



            <!--腰线-开始-->

            <!--育儿课程-开始-->
            <div class="shoplist" style="margin-top: 20px;">
                <div class="title" style="font-weight: bold;">推荐商品</div>
                <ul>
                    <li v-for="item in recommend">
                        <a @tap="opendetail(item)" style="border: 1px solid #f7f7f7;border-radius: 5px;overflow: hidden;">
                            <div style="padding: 5px;">
                                <img :src="item.pic" />
                            </div>
                            <div class="shopinfo">
                                <div class="shop_title">{{item.name}}</div>
                                <div style="display: flex;flex-wrap: nowrap;position: relative; width: 100%;padding-top: 10px;">
                                    <span><span style="color: #ffc832;font-weight: bold;">{{item.point}}</span>积分</span>
                                    <span style="position: absolute;top: 10px;right: 0px;">库存{{item.count}}件</span>
                                </div>
                            </div>
                        </a>
                    </li>
                </ul>
            </div>
        </div>

        <!--育儿课程-结束-->
    </div>

</body>

<script type="text/javascript" src="../../../js/jquery-1.8.3.min.js"></script>
<script src="../../../js/idangerous.swiper.min.js"></script>
<script src="../../../js/mui.js"></script>
<script src="../../../js/vue.min.js"></script>
<script src="../../../js/app.js"></script>
<script src="../../../js/token.js"></script>
<script>
    var uid = "";
    var favoritestatus = 0;
    var refresh = 1;
    var point = '';
    //mui初始化，配置下拉刷新

    mui.plusReady(function() {
        var gallery = mui('.mui-slider');
        gallery.slider({
            interval: 5000 //自动轮播周期，若为0则不自动播放，默认为0；
        });
        plus.push.addEventListener("receive", function(msg) {
                alert(msg)
            })
            //plus.runtime.setBadgeNumber(3); 
        var state = app.getState();
        var point = '';
        uid = state.userid;

        memberToken = state.memberToken;

        paradata = {
            uid: uid,
            memberToken: memberToken,

        };
        //轮播图
        mui.post(Apiurl+'index/banner', {
            uid: uid,
            memberToken: memberToken,
            type: 5
        }, function(data) {
            var bannerHtml = "";
            //alert(JSON.stringify(data[0].banner_url))
            for (var i = 0; i < data.length; i++) {
                bannerHtml += "<div class=\"swiper-slide\" onclick=\"open_detail('" + data[i].banner_url + "','" + data[i].banner_title + "');\"><img src='" + data[i].banner_pic + "'></div>";
            }
            $(".swiper-wrapper").html(bannerHtml);
            var mySwiper = new Swiper('.swiper-container', {
                loop: true,
                pagination: '.pagination',
                paginationClickable: true,
                moveStartThreshold: 100,
                centeredSlides: true,
                autoplay: 3500,
                autoplayDisableOnInteraction: false
            })

        }, 'json')

        mui.post(Apiurl+'index/banner', {
                uid: uid,
                memberToken: memberToken,
                type: 6
            }, function(data) {

                for (var i = 0; i < data.length; i++) {
                    //console.log(data[i].banner_pic) 
                    shop.banners.push(data[i].banner_pic)
                }

            }, 'json')
            //分类按钮
        mui.post(Apiurl+'shop/type', {
            uid: uid,
            memberToken: memberToken
        }, function(data) {
            //alert(JSON.stringify(data.list))
            shop.types = data.list;
        }, 'json');
        mui.post(Apiurl+'shop/list', {
            uid: uid,
            memberToken: memberToken,
        }, function(data) {

            shop.recommend = data.list

        }, 'json')
        var curWebview;
        var backButtonPress = 0;
        var old_back = mui.back;
        //为您优选

    });

    var shop = new Vue({
        el: '#shop',
        data: {
            banners: [], //顶部banner数据
            types: [], //分类数据
            recommend: []
        },

        methods: {
            openlist: function(type) {
                var typeid = type.id

                mui.openWindow({
                    url: 'shoplist.html',
                    id: 'shoplist',
                    extras: {
                        type: "dict",
                        typeid: typeid
                    },
                    styles: {
                        "render": "always",
                        "popGesture": "hide",
                        "bounce": "vertical", 
                        "bounceBackground": "#efeff4",
                        "titleNView": titleNView = { //详情页原生导航配置
                            autoBackButton: true, //自动绘制返回箭头
                            backgroundColor: '#fff', //导航栏背景色
                            titleText: type.name, //导航栏标题
                            titleColor: '#000', //文字颜色
                            //coverage:"120px",
                            //type: 'transparent', //透明渐变样式

                        }
                    },
                });
            },

            opendetail: function(item) {
                mui.openWindow({
                    url: 'shopcontent.html',
                    id: 'shopcontent',
                    extras: {
                        instid: item.id
                    },
                    styles: {
                        "render": "always",
                        "popGesture": "hide",
                        "bounce": "vertical",
                        "bounceBackground": "#efeff4",
                        "titleNView": titleNView = { //详情页原生导航配置
                            autoBackButton: true, //自动绘制返回箭头
                            titleText: '',
                            titleColor: '#fff', //文字颜色
                            //coverage:"120px",
                            type: 'transparent', //透明渐变样式
                        }
                    },
                    createNew: true,

                });
            },

        }
    });




    //打开微信文章详情 
    function banner_detail(bannerurl, bannertitle) {
        mui.openWindow({
            url: bannerurl,
            id: 'ad_detail',
            styles: {
                "render": "always",
                "popGesture": "hide",
                "bounce": "vertical",
                "bounceBackground": "#efeff4",
                "titleNView": titleNView = { //详情页原生导航配置
                    autoBackButton: true, //自动绘制返回箭头
                    backgroundColor: '#25aae3', //导航栏背景色
                    titleText: bannertitle, //导航栏标题
                    titleColor: '#F7F7F7', //文字颜色
                    //coverage:"120px",
                    //type: 'transparent', //透明渐变样式
                    splitLine: { //底部分割线
                        color: '#cccccc'
                    }
                }
            }
        });
    }
</script>

</html>